<template>
  <div>
    <!-- 
    default-active 设置高亮 
    collapse 设置折叠 
    -->
    <el-aside :width="$store.state.isCollapse?'64px':'200px'">
      <el-menu :collapse="$store.state.isCollapse" 
      :collapse-transition="false"
      :router="true"
      :default-active="route.fullPath"
      >
        <el-menu-item index="/home">
          <el-icon><HomeFilled /></el-icon>
          <span>首页</span>
        </el-menu-item>
        <el-menu-item index="/center">
          <el-icon><Avatar /></el-icon>
          <span>个人中心</span>
        </el-menu-item>
        <el-sub-menu index="/User">
          <template #title>
            <el-icon><UserFilled /></el-icon>
            <span>用户管理</span>
          </template>
          <el-menu-item index="/User/useradd">添加用户</el-menu-item>
          <el-menu-item index="/User/userlist">用户管理</el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="/News">
          <template #title>
            <el-icon><MessageBox /></el-icon>
            <span>新闻管理</span>
          </template>
          <el-menu-item index="/News/newsadd">添加新闻</el-menu-item>
          <el-menu-item index="/News/newslist">新闻管理</el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="/Product">
          <template #title>
            <el-icon><Reading /></el-icon>
            <span>产品管理</span>
          </template>
          <el-menu-item index="/Product/productadd">添加产品</el-menu-item>
          <el-menu-item index="/Product/productlist">产品列表</el-menu-item>
        </el-sub-menu>
      </el-menu>
    </el-aside>
  </div>
</template>

<script setup>
import router from "@/router";
import { useRoute } from "vue-router";
const route = useRoute();
import {
  HomeFilled,
  Avatar,
  UserFilled,
  MessageBox,
  Reading,
  Pointer,
} from "@element-plus/icons-vue";
</script>

<style lang="scss">
.el-aside {
  height: 100vh;
}
.el-menu{
  height: 100%;
}
</style>
